#include <SFML/Window.hpp> 
#include <SFML/OpenGL.hpp>
#include <SFML/Graphics.hpp>
#include <cmath>
#include "yuDraw.h"

yuDraw::yuDraw(void)
{
}


void yuDraw::DrawSprite(sf::Image &siSprite, double x, double y, double r, double g, double b, double a) {
	siSprite.Bind();
	glBegin(GL_QUADS);

	glColor4f(r,g,b,a);
	int* meh = 0;
	float tx = frexp((double)(siSprite.GetWidth()),meh);
	float ty = frexp((double)(siSprite.GetHeight()),meh);
	if(tx==0.5){
		tx = 1;
	}
	if(ty==0.5){
		ty = 1;
	}

	glTexCoord2f(0,0);
	glVertex2f(x,y);
	glTexCoord2f(tx,0);
	glVertex2f(x+siSprite.GetWidth(),y);
	glTexCoord2f(tx,ty);
	glVertex2f(x+siSprite.GetWidth(),y+siSprite.GetHeight());
	glTexCoord2f(0,ty);
	glVertex2f(x,y+siSprite.GetHeight());

	glEnd();
}